<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%><%@taglib
	uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>Register to join with me</title>
	<meta  charset="UTF-8" />
	<link href="css/style.css" rel="stylesheet" type="text/css" />
	<!--[if IE 6]>
		<link href="css/ie6.css" rel="stylesheet" type="text/css" />
	<![endif]-->
	<!--[if IE 7]>
        <link href="css/ie7.css" rel="stylesheet" type="text/css" />  
	<![endif]-->
	
</head>

<body>
	  <div id="background">
			  <div id="page">
			
					 <div class="header">
						<div class="footer">
							<div class="body">
							  
							  	<!-- include Menu -->
									<jsp:include page="Menu.jsp" flush="True">
										<jsp:param name="page_call"  value="UpdateNews"/>
									</jsp:include>
									
									<div id="content" >
									    <img src="images/cotton-flower.jpg" width="726" height="546" alt="" title="">
										<div class="pagetitlebar">
											<span style="margin-left:80px;font-size:15px;">
												<a href="HotNews.jsp" style="color:#ffffff">back to all book items.</a></span>
											</div>
										<div class="pagecontent">
										<b>รายหนังสือ</b>
											<form name="formSearchBook"method="post" action="#">
												เลือกประเภทหนังสือ :
												<select name = "bookType">
													<sql:setDataSource dataSource="jdbc/sharewithme" var="sharewithme" />
													<c:catch var="ex">
														<sql:query var="bookTypes" dataSource="${sharewithme}">
															select BType_ID,BType_Name from TBBookType
														</sql:query>
													</c:catch>
													<c:forEach items="${bookTypes.rows}" var="item">
														<option value="${item.BType_ID}">${item.BType_Name}</option>
													</c:forEach>
													
												</select>
												<input type="submit" name="btnSearchBook" value="Search">
												<input type="submit" name="btnAddBook" value="Add Book" style="cursor:pointer">
											</form>
															
											<table style="border:1px solid;">
												<thead>
													<th>ISBN</th>
													<th>ชื่อหนังสือภาษาไทย</th>
													<th>ชื่อหนังสือภาษาอังกฤษ</th>
													<th>ชื่อผู้เขียน</th>
												</thead>
												
												<c:catch var="ex">
													<sql:query var="books" dataSource="${sharewithme}">
														select BISBN, BNameThai, BNameEng, BWriter, BPublishing, BEdition, BTranslate, BPrice, BTypeID, BPicName, BCountPage
														from tbbooks 
														where btypeid='${param.bookType}'
													</sql:query>
												</c:catch>
												<c:forEach items="${books.rows}" var="book">
													<tr>
														<td><a href="AdminBookDetail.jsp">${book.BISBN}</a></td>
														<td>${book.BNameThai}</td>
														<td>${book.BNameEng}</td>
														<td>${book.BWriter}</td>
													</tr>
												</c:forEach>
											</table>
											
												
								

							</div>
									
									</div>
									
									
						</div>
					 </div>
					 <div class="shadow">&nbsp;</div>
			  </div>    
	  </div>    
	</div>
</body>
</html>